<template>
    <div class="mine-info-root">
        <el-breadcrumb style="margin-bottom: 10px;" separator="/">
            <el-breadcrumb-item>我的</el-breadcrumb-item>
            <el-breadcrumb-item>我的订单</el-breadcrumb-item>
        </el-breadcrumb>

        <el-table :data="tableData" style="width: 100%; max-height: 500px;min-height: 400px">
            <el-table-column
                prop="goods_id"
                label="商品id"
                width="180">
            </el-table-column>
            <el-table-column
                label="商品名称"
                width="180">
                <template slot-scope="props">
                    {{props.row.goods.title}}
                </template>
            </el-table-column>
            <el-table-column
                label="卖家">
                <template slot-scope="props">
                    {{props.row.seller.name}}
                </template>
            </el-table-column>
            <el-table-column
                prop="start"
                label="买家">
                <template slot-scope="props">
                    {{props.row.buyer.name}}
                </template>
            </el-table-column>
            <el-table-column
                prop="created_at"
                label="创建时间">
            </el-table-column>
            
        </el-table>
        <div style="text-align: right; margin: 20px">
            <el-pagination
                layout="prev, pager, next"
                @current-change="getList"
                :total="this.total"
            >
            </el-pagination>
        </div>
    </div>
</template>

<script>
import {serviceRequest} from "network/request.js";
export default {
    data() {
        return {
            tableData: [],
            addModalShow: false,
            addInfo: {
                title:  '',
                content: '',
                id: '',
            },
            offset: 0,
            total: 0,
        };
    },
    computed: {
    },
    mounted() {
    },
    created() {
        this.getList();
    },
    methods: {
        getList(page) {
            if ('number' === typeof page) {
                this.offset  = 10 * (page - 1);
            } else {
                this.offset = 0;
            }
            const params = {
                url: '/user/order/get',
                method: 'get',
                data: {
                    offset: this.offset,
                }
            }
            serviceRequest(params).then(res => {
                this.tableData = res.content.data;
                this.total = res.content.total;
            });
        },
    },
};
</script>

<style lang="scss" scoped>
.mine-info-root {
    padding: 0 20px;
    background-color: #fff;
    margin-top: 50px;
}
</style>